package com.neuedu.rui.baseui;

import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.ImageIcon;
import javax.swing.JLabel;

public class ButtonPanel extends AeroPanel {
	
	public static final int BASE_WIDTH = 70;
	public static final int BASE_HEIGHT = 25;


	final Image btn = new ImageIcon("imgs/blue_btn.png").getImage();
	final Image btn2 = new ImageIcon("imgs/blue_btn2.png").getImage();
	
	Image im;

	public ButtonPanel(String text) {
		this.im = btn;
		JLabel label = new JLabel(text);
		label.setForeground(Color.WHITE);
		this.add(label);
		this.setSize(BASE_WIDTH, BASE_HEIGHT);
		this.setPreferredSize(new Dimension(BASE_WIDTH, BASE_HEIGHT));
	
		this.addMouseListener(new MouseAdapter() {
			public void mouseReleased(MouseEvent e) {
				im = btn;
				repaint();
			}

			public void mousePressed(MouseEvent e) {
				im = btn2;
				repaint();
			}

		});
	}

	public void paintComponent(Graphics g) {
		super.paintComponents(g);
		g.drawImage(im, 0, 0, this.getWidth(), this.getHeight(), this);
	}
}
